

import Foundation

extension Date {

    static let logStringDateFormat = "yyyy-MM-dd HH:mm:ss.SSSSSSZ"

    static let logDateFormatter: DateFormatter = {
        let dateFormatter = DateFormatter()
        dateFormatter.dateFormat = logStringDateFormat
        return dateFormatter
    }()

 
    func toString(dateFormatter: DateFormatter = Date.logDateFormatter) -> String {
        return dateFormatter.string(from: self)
    }
}
